<template>
  <div class="search">
    <f-form ref="form" :action="api.bfd" :form-key="this.formItem.financeId">
      <f-form-item label="原单号" name="orderNo" :value="formItem.orderNo"/>
      <f-form-item label="发货金额差异" name="saleAmount" :value="formItem.saleAmount"/>
      <f-form-item label="客户回款差异" name="returnAmount" :value="formItem.returnAmount"/>
      <f-form-item label="应付结算差异" name="settleAmount" :value="formItem.settleAmount"/>
      <f-form-item label="已付结算差异" name="yesSettleAmount" :value="formItem.yesSettleAmount"/>
      <f-form-item label="备注" name="remark" :value="formItem.remark"/>
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'

  export default {
    name: 'financeForm',
    props: {},
    data() {
      return {
        refs: this.$refs,
        api: Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          financeId: '',
          saleAmount: '',
          returnAmount: '',
          debtAmount: '',
          cBondAmount: '',
          cBondReturnAmount: '',
          settleAbleAmount: '',
          settleRealAmount: '',
          settleTotalamount: '',
          remark: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.financeId) {
          let params = {
            financeId: data.financeId
          }
          this.formItem.financeId=data.financeId;
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({financeId: this.formItem.financeId}, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
